﻿using System;
using System.Windows;
using DALHelper.Business;
using System.Windows.Controls;

namespace ResortManager
{
    /// <summary>
    /// Interaction logic for wndRegister.xaml
    /// </summary>
    public partial class pgRegister : Page
    {
        private Transaction m_transEditing;
        public Transaction EditingTransaction
        {
            get { return m_transEditing; }
            set
            {
                m_transEditing = value;
                proGrid.Instance = m_transEditing;
            }
        }

        public bool IsEditing
        {
            get;
            set;
        }

        public pgRegister()
        {
            InitializeComponent();
        }

        //private void btnAdd_Click(object sender, RoutedEventArgs e)
        //{
        //    if (Action() && !IsEditing)
        //    {
        //        EditingTransaction = new Transaction();
        //    }
        //}

        //private void btnCancel_Click(object sender, RoutedEventArgs e)
        //{
        //    Close();
        //}

        //private bool Action()
        //{
        //    try
        //    {
        //        BusinessManager busManager = ((App)App.Current).BUSManager;

        //        if (IsEditing)
        //        {
        //            busManager.Transaction.UpdateTransaction(EditingTransaction);
        //        }
        //        else
        //        {
        //            busManager.Transaction.AddTransaction(EditingTransaction);
        //        }
        //        return true;
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show("Có lỗi khi thực hiện.\r\nVui lòng kiểm tra lại!\r\n\r\n" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
        //        return false;
        //    }
        //}
    }
}
